﻿using B.S.DataBase.MyProject.Domain.Procurements;
using B.S.DataBase.MyProject.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using T.E.ERP.Read.API.Applicantions.Command.ProcurementsCommand;
using T.E.ERP.Read.API.Dtos.Dtos;

namespace T.E.ERP.Read.API.Controllers
{
    /// <summary>
    /// 开票通知单的控制器-读
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ProcurementsController : ControllerBase
    {
        /// <summary>
        /// 中介者
        /// </summary>
        private readonly IMediator mediator;
        /// <summary>
        /// 构造方法
        /// </summary>
        /// <param name="mediator"></param>
        public ProcurementsController(IMediator mediator)
        {
            this.mediator = mediator;
        }


        #region 开票通知单

        /// <summary>
        /// 查询开票通知单
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<InvoiceSettlementEntity>>> GetInvoiceSettlementEntity([FromQuery] InvoiceSettlementEntityQueryCommand command)
        {
            return await mediator.Send(command);
        }


        /// <summary>
        /// 查询开票通知单（所有数据）
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<InvoiceDtos>>> GetInvoiceSettlementEntityALL([FromQuery] GetInvoiceSettlementEntityCommand command)
        {
            return await mediator.Send(command);
        }

        /// <summary>
        /// 查询开票通知单（反填）
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<FanInvoiceSettlementEntityDtos>>> FanTianInvoiceSettlementEntityALL([FromQuery] FanTianInvoiceCommand command)
        {
            return await mediator.Send(command);
        }


        #endregion





        /// <summary>
        /// 业务类型查询
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<Document>>> GetDocument()
        {
            return await mediator.Send(new DocumentCommand());
        }

        /// <summary>
        /// 采购部门查询
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<PurchasingDtos>>> GetPurc([FromQuery] PurchasingCommmand commmand)
        {
            return await mediator.Send(commmand);
        }





    }
}
